﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Habi.Solver.Helpers
{
    public class DateTimeHelper
    {
        public static DateTime? FromFileCreateTime(string filePath)
        {

            if (string.IsNullOrEmpty(filePath)) return null;

            if (File.Exists(filePath))
            {
                FileInfo fileInfo = new FileInfo(filePath);
                return fileInfo.CreationTime;
            }
            else if (Directory.Exists(filePath))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(filePath);
                return directoryInfo.CreationTime;
            }

            return null;
        }
    }
}
